package cc.yugu.yhdw.webserver.web.controller.security.basic;

import cc.yugu.yhdw.common.annotation.ViewModel;
import cc.yugu.yhdw.common.domain.basic.Agent;
import cc.yugu.yhdw.common.domain.basic.AgentInOutMoney;
import cc.yugu.yhdw.common.entity.json.PageResult;
import cc.yugu.yhdw.webserver.entity.SessionUser;
import cc.yugu.yhdw.webserver.service.basic.AgentInOutMoneyService;
import cc.yugu.yhdw.webserver.service.basic.AgentService;
import cc.yugu.yhdw.webserver.web.controller.security.SecurityController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 运营资金流水控制器
 * 
 * @Date:Created in 2018/7/17 11:30
 * @Author:
 * @Modified By: zjn 2018/7/17 11:30
 */ 
@Controller
@RequestMapping(value = "/security/basic/agent_in_out_money")
public class AgentInOutMoneyController extends SecurityController {
    @Autowired
    AgentInOutMoneyService agentInOutMoneyService;

    /**
    * 分页查询运营商资金流水信息
    * 
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.entity.json.PageResult
    * @Author By: zjn 2018/7/17  11:31
    */ 
    @RequestMapping("page.htm")
    @ViewModel(ViewModel.JSON)
    @ResponseBody
    public PageResult page(AgentInOutMoney search) {
        return PageResult.successResult(agentInOutMoneyService.findPage(search));
    }
    /**
    * 新增：首页账户余额信息分页查看
    *
    * @Param: [search]
    * @Return: cc.yugu.yhdw.common.entity.json.PageResult
    * @Author By: zjn 2018/8/31  16:59
    */
    @RequestMapping("pageMoney.htm")
    @ViewModel(ViewModel.JSON)
    @ResponseBody
    public PageResult pageMoney(AgentInOutMoney search, HttpSession httpSession) {
        SessionUser sessionUser = getSessionUser(httpSession);
        search.setAgentId(sessionUser.getAgentId());
        return PageResult.successResult(agentInOutMoneyService.findPage(search));
    }

}
